/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.amse.grigory.dchess.io;

import java.io.*;
import java.util.*;
import org.amse.grigory.dchess.dchess.DChess;

/**
 *
 * @author grigory
 */
public class ConfigLoader {
    private static ClassLoader ourDClass= DChess.class.getClassLoader();
    
    private String[] myTheme,myRules,myTName,myRName;
    private int myTCount,myRCount;
    public ConfigLoader() throws FileNotFoundException{
        Scanner sc=new Scanner(ourDClass.getResourceAsStream("config"));
        String t;
        t=sc.next();
        myTCount=Integer.valueOf(t);
        myTheme=new String[myTCount];
        myTName=new String[myTCount];
        for (int i=0; i<myTCount; i++){
            t=sc.next();
            myTName[i]=t;
            t=sc.next();
            myTheme[i]=t;
        }
        t=sc.next();
        myRCount=Integer.valueOf(t);
        myRules=new String[myRCount];
        myRName=new String[myRCount];
        for (int i=0; i<myRCount; i++){
            t=sc.next();
            myRName[i]=t;
            t=sc.next();
            myRules[i]=t;
        }
        sc.close();
    }
    
    public String getTheme(int index){
        return myTheme[index];
    }

    public String getRules(int index){
        return myRules[index];
    }

    public String getThemeName(int index){
        return myTName[index];
    }

    public String getRulesName(int index){
        return myRName[index];
    }

    public int getRulesCount(){
        return myRules.length;
    }

    public int getThemeCount(){
        return myTheme.length;
    }

}
